<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ccDetail="http://xmlns.jcp.org/jsf/composite/compositions/candidateDetail">

    <body>

        <ui:composition template="/WEB-INF/templates/newMainCompanyTemplate.xhtml">
            <ui:define name="bag"></ui:define>
            <ui:define name="content">


                <p:dialog id="candidateBagDetailDialog" widgetVar="candidateBagDetailDialog" resizable="false" modal="true" position="top">
                    <ccDetail:CandidateDetailPanel id="candidateBagDetailPanel"
                                                   bean="#{bagBean}"
                                                   candidate="#{bagBean.selectedCandidate}"                    
                                                   >
                    </ccDetail:CandidateDetailPanel>
                    <h:form>
                        <p:commandButton styleClass="blueBackgroundStrong inlineBlock" actionListener="#{bagBean.removeCandidate(bagBean.selectedCandidate)}" update=":bagFacesForm:bagFacesPanel :candidateBagDetailPanel" oncomplete="PF('candidateBagDetailDialog').hide();" value="#{messages.Remove}" process="@this"></p:commandButton>                    
                    </h:form>  
                </p:dialog>


                <h:form id="bagFolderForm">
                    <p:selectOneMenu style="width:30%!important; margin-right: 3%!important; display:inline-block;vertical-align: top;" converter="#{companyFolderConverter}" id="selectCompanyFolder" value="#{bagBean.folder}" effect="fade" required="false" label="#{messages.SearchFolder}">  
                        <f:selectItem itemLabel="#{messages.AllProfiles}" itemValue="" />  
                        <f:selectItems value="#{bagBean.company.companyFolderList}" var="companyFolder" itemLabel="#{companyFolder.description}" itemValue="#{companyFolder}"/>  
                    </p:selectOneMenu>
                    <p:commandButton value="#{messages.Recruit}" action="#{bagBean.recruitWithoutSearch()}"></p:commandButton>
                </h:form>

                <h:form id="bagFacesForm">
                    <p:panel id='bagFacesPanel'>
                        <ui:repeat rendered="#{not empty bagBean.selectedCandidates}" id="bagCandidates" var="candidate" value="#{bagBean.selectedCandidates}">
                            <div style="display:inline-block;width:23.50%;">
                                <h:form>
                                    <p:commandLink actionListener="#{bagBean.setSelectedCandidate(candidate)}" oncomplete="PF('candidateBagDetailDialog').show();" styleClass="imagenBusqueda" process="@this" update=":candidateBagDetailDialog" style="display:block;">  
                                        <h:graphicImage style="min-height: 135px;" rendered="#{candidate.bustColor!=null and adquiredCandidatesBean.isAdquired(candidate)}" styleClass="width100" value="/candidateFiles/#{candidate.idCandidate.toString()}/images/#{candidate.bustColor}"></h:graphicImage>                 
                                        <h:graphicImage style="min-height: 135px;" rendered="#{candidate.bustBlackWhite!=null and !adquiredCandidatesBean.isAdquired(candidate)}" styleClass="width100" value="/candidateFiles/#{candidate.idCandidate.toString()}/images/#{candidate.bustBlackWhite}"></h:graphicImage>                 
                                    </p:commandLink>
                                </h:form>
                            </div>
                        </ui:repeat>
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
